<cfcomponent output="false">
	
	<!--- --->
	
	<cffunction name="form" access="public" output="false" returntype="string">
		<cfargument name="cfc" required="true" />
		<cfargument name="method" required="true" />

		<cfreturn "/cfcs/action.cfm?cfc=#arguments.cfc#&method=#arguments.method#">
		
	</cffunction>
	
	<!--- --->
	
	<cffunction name="setArg" access="public" output="false" returntype="string">
		<cfargument name="link" required="true" />
		<cfargument name="name" required="true" />
		<cfargument name="value" required="false" default="" />
		
		<cfset var local = {} />
		
		<cfset local.urlStruct = urlToStruct(arguments.link) />
		
		<cfset local.urlStruct.args[arguments.name] = urlEncodedFormat(arguments.value) />
		
		<cfset local.url = structToURL(local.urlStruct) />

		<cfreturn local.url />
		
	</cffunction>
	
	<!--- --->
	
	<cffunction name="removeArg" access="public" output="false" returntype="string">
		<cfargument name="link" required="true" />
		<cfargument name="name" required="true" />
		
		<cfset var local = {} />
		
		<cfset local.urlStruct = urlToStruct(arguments.link) />
		
		<cfset structDelete(local.urlStruct.args,arguments.name) />
		
		<cfset local.url = structToURL(local.urlStruct) />

		<cfreturn local.url />
		
	</cffunction>
	
	<!--- --->
	
	<cffunction name="urlToStruct" access="public" output="false" returntype="struct">
		<cfargument name="link" required="true" />
		
		<cfset var local = {} />
		
		<cfset local.result = {} />
		
		<cfset local.result.url = listGetAt(arguments.link,1,"?") />
		<cfset local.result.args = {} />
		<cfset local.argList = "" />
		
		<cfif listLen(arguments.link,"?") gt 1>
			<cfset local.argList = listGetAt(arguments.link,2,"?") />
		</cfif>
		
		<cfloop list="#local.argList#" item="local.item" index="local.i" delimiters="&">
			<cfset local.name = listGetAt(local.item,1,"=") />
			<cfset local.value = "" />
			<cfif listLen(local.item,"=") gt 1>
				<cfset local.value = listGetAt(local.item,2,"=") />
			</cfif>
			<cfset local.result.args[local.name] = local.value />
		</cfloop>

		<cfreturn local.result />
		
	</cffunction>
	
	<!--- --->
	
	<cffunction name="structToURL" access="public" output="false" returntype="string">
		<cfargument name="struct" required="true" />
		
		<cfset var local = {} />
		
		<cfset local.result = arguments.struct.url & '?' />
		
		<cfloop collection="#arguments.struct.args#" item="local.item" index="local.i">
			<cfset local.result = local.result & "#local.i#" />
			<cfif arguments.struct.args[local.i] neq "">
				<cfset local.result = local.result & "=#arguments.struct.args[local.i]#" />
			</cfif>
			<cfset local.result = local.result & "&" />
		</cfloop>

		<cfreturn local.result />
		
	</cffunction>
	
	<!--- --->
	
	<cffunction name="getArg" access="public" output="false" returntype="string">
		<cfargument name="link" required="true" />
		<cfargument name="name" required="true" />
		
		<cfset var local = {} />
		
		<cfset local.struct = urlToStruct(arguments.link) />
		<cfset local.value = "" />
		
		<cfif structKeyExists(local.struct.args,arguments.name)>
			<cfset local.value = true />
			<cfif local.struct.args[arguments.name] neq "">
				<cfset local.value = local.struct.args[arguments.name] />
			</cfif>
		</cfif>

		<cfreturn local.value />
		
	</cffunction>
	
	<!--- --->

</cfcomponent>